package zw_901_1000.zw_941_有效的山脉数组;

class Solution {
    public static void main(String[] args) {
        int[] arr = {2, 1};
        boolean b = validMountainArray(arr);
        System.out.println(b);
    }

    public static boolean validMountainArray(int[] arr) {
        int left = 0, right = arr.length - 1;
        while (left < arr.length - 1 && arr[left] < arr[left + 1]) {
            left++;
        }
        while (right > 0 && arr[right] < arr[right - 1]) {
            right--;
        }
        return left == right && left != 0 && right != arr.length - 1;
    }
}
